package cn.kgc.springboot06.controller;

import cn.kgc.springboot06.entity.Dept;
import cn.kgc.springboot06.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: 课工场
 * @Version: v1.0  2023/3/28
 * @Description:
 */
@RestController
@RequestMapping("dept")
public class DeptController {

    @Autowired
    private DeptService deptService;

    @GetMapping("list")
    public List<Dept> getList(){
        List<Dept> list = deptService.list();
        return  list;
    }


    @DeleteMapping("{id}")
    public String deleteById(@PathVariable Integer id){

        deptService.removeById(id);

        return  "ok";
    }


}
